package com.yanqu.road.entity.activity.horserun.cross;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.activity.horserun.entity.HorseRunTrackPartData;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;

@FieldTypeAnnotation(tableName = "t_c_horse_run_track_data",desc = "小马快跑赛场赛道数据")
public class CrossHorseRunTrackData extends DataObject {

    @FieldTypeAnnotation(select = true,update = true,desc = "活动id")
    private int activityId;
    @FieldTypeAnnotation(select = true,update = true,desc = "分组id")
    private int groupId;
    //天数
    @FieldTypeAnnotation(desc = "天数",update = true)
    private int day;
    //赛区
    @FieldTypeAnnotation(desc = "赛区",update = true)
    private int zone;
    //总长度
    @FieldTypeAnnotation(desc = "总长度")
    private int totalLength;
    @FieldTypeAnnotation(desc = "各个属性的总长度")
    private Map<Integer,Integer> attrTotalLength;
    //分段数据
    @FieldTypeAnnotation(desc = "分段数据",saveJson = true)
    private List<HorseRunTrackPartData> partData;
    //是否结算
    @FieldTypeAnnotation(desc = "是否结算")
    private boolean isSettlement;
    @FieldTypeAnnotation(desc = "应该结算的时间戳")
    private long needSettlementTime;

    //加入玩家 不持久化了 load玩家的时候直接塞进来吧
    private Set<Long> joinMember = new ConcurrentSkipListSet<>();

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public int getGroupId() {
        return groupId;
    }
    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setOp(DataStatus.Update);
        }
    }

    public int getDay() {
        return day;
    }
    public void setDay(int day) {
        if (this.day != day) {
            this.day = day;
            setOp(DataStatus.Update);
        }
    }

    public int getZone() {
        return zone;
    }
    public void setZone(int zone) {
        if (this.zone != zone) {
            this.zone = zone;
            setOp(DataStatus.Update);
        }
    }

    public int getTotalLength() {
        return totalLength;
    }
    public void setTotalLength(int totalLength) {
        if (this.totalLength != totalLength) {
            this.totalLength = totalLength;
            setOp(DataStatus.Update);
        }
    }

    public java.util.Map<java.lang.Integer, java.lang.Integer> getAttrTotalLength() {
        return attrTotalLength;
    }
    public void setAttrTotalLength(java.util.Map<java.lang.Integer, java.lang.Integer> attrTotalLength) {
        if (null == attrTotalLength){
            return;
        }
        if (this.attrTotalLength == null || !this.attrTotalLength.equals(attrTotalLength)) {
            this.attrTotalLength = attrTotalLength;
            setOp(DataStatus.Update);
        }
    }

    public java.util.List<com.yanqu.road.entity.activity.horserun.entity.HorseRunTrackPartData> getPartData() {
        return partData;
    }
    public void setPartData(java.util.List<com.yanqu.road.entity.activity.horserun.entity.HorseRunTrackPartData> partData) {
        if (null == partData){
            return;
        }
        if (this.partData == null || !this.partData.equals(partData)) {
            this.partData = partData;
            setOp(DataStatus.Update);
        }
    }

    public boolean getIsSettlement() {
        return isSettlement;
    }
    public void setIsSettlement(boolean isSettlement) {
        if (this.isSettlement != isSettlement) {
            this.isSettlement = isSettlement;
            setOp(DataStatus.Update);
        }
    }

    public long getNeedSettlementTime() {
        return needSettlementTime;
    }
    public void setNeedSettlementTime(long needSettlementTime) {
        if (this.needSettlementTime != needSettlementTime) {
            this.needSettlementTime = needSettlementTime;
            setOp(DataStatus.Update);
        }
    }

    public boolean isSettlement() {
        return isSettlement;
    }

    public Set<Long> getJoinMember() {
        return joinMember;
    }

    public void setJoinMember(Set<Long> joinMember) {
        this.joinMember = joinMember;
    }


    public void addSignMember(long userId){
        this.joinMember.add(userId);
    }

    public void removeSignMember(long userId){
        this.joinMember.remove(userId);
    }
}
